import com.spj.dao.GoodDao;
import com.spj.dao.UserDao;
import com.spj.pojo.GoodCategory;
import com.spj.pojo.User;
import com.spj.service.dao.CartServiceDao;
import com.spj.service.dao.UserServiceDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;

/**
 * @author :spj
 * @description:
 */
public class Test {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("springConfig.xml");
//        UserDao userDao = applicationContext.getBean("userDao", UserDao.class);
//        User user = userDao.findUserById(23);
//        System.out.println(user);
//        UserServiceDao userServiceImpl = applicationContext.getBean("userServiceImpl", UserServiceDao.class);
//查       User user = userServiceImpl.findUserById(23);
//        System.out.println(user);
//增       User user=new User();
//        user.setUsername("spring");
//        user.setPassword("test");
//        user.setEmail("test");
//        userServiceImpl.registUser(user);
//        System.out.println(user);
//改        User user = new User();
//        user.setId(26);
//        user.setPassword("newPassword");
//        userServiceImpl.changePasswod(user);
//        System.out.println(userServiceImpl.findUserById(26));
        //删
        CartServiceDao cartServiceImpl = applicationContext.getBean("cartServiceImpl", CartServiceDao.class);
        cartServiceImpl.deleteCart(11);
    }
}
